<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <meta http-equiv="X-UA-Compatible" content="IE=edge">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>Document</title>
</head>
<body>
    <script>
        // var fn = function(){
        //     console.log("fn");
        // }
        // var fn=()=>{
        //     console.log("fn");
        // }
        // fn();


        var data = [
            {
                id: 1,
                name: '小明',
                age: 24,
                gender: '男'
            },
            {
                id: 2,
                name: '小芳',
                age: 30,
                gender: '女'
            },
            {
                id: 3,
                name: '小美',
                age: 31,
                gender: '女'
            },
            {
                id: 4,
                name: '小刚',
                age: 21,
                gender: '男'
            },
            {
                id: 5,
                name: '小琪',
                age: 18,
                gender: '女'
            }
        ];

        let res = data.filter(item=>item.age>20).filter(item=>item.gender ==="男")
        console.log(res);




        // 要求 年龄大于20岁，且是女生
        // var res = data.filter(item=>item.age>20).filter(item=>item.gender==="女");
        // console.log(res);

    </script>
</body>
</html>